from django.urls import path

# from rest_framework_jwt.views import obtain_jwt_token
from apps.meiduo_admin.login import meiduo_admin_login
from apps.meiduo_admin.views import home, user, image, sku

urlpatterns = [
    # TODO 用户的登录
    path('authorizations/', meiduo_admin_login),

    # TODO 统计日活用户
    path('statistical/day_active/', home.DailyActiveCountAPIView.as_view()),

    # TODO 统计下单用户
    path('statistical/day_orders/', home.DailyOrderCountAPIView.as_view()),

    # TODO 统计月增用户
    path('statistical/month_increment/', home.MonthAddCountAPIView.as_view()),

    # TODO 用户管理
    path('users/', user.UserListAPIView.as_view()),

    # TODO 新增图片中 获取所有的sku
    path('skus/simple/', image.SKUSimpleListAPIView.as_view()),

    # TODO 新增SKU中 获取三级分类数据
    path('skus/categories/', sku.GoodsCategoryAPIView.as_view()),

    # TODO 新增SKU中 获取spu数据
    path('goods/simple/', sku.SimpleSPUListAPIView.as_view()),

    # TODO 根据spu_id 获取规格和选项
    path('goods/<spu_id>/specs/', sku.SpecAPIView.as_view()),
]
from rest_framework.routers import DefaultRouter, SimpleRouter

# TODO 1. 创建router实例对象
router = DefaultRouter()
# TODO 2. 注册url
router.register('skus/images', image.SKUImageModelViewSet, basename='images')
# TODO 3. 将router生成的url追加到urlpatterns
urlpatterns += router.urls

# TODO 2. 注册url
router.register('skus', sku.SKUModelViewSet, basename='skus')
# TODO 3. 将router生成的url追加到urlpatterns
urlpatterns += router.urls
